import { createApp } from 'vue';
import Cookies from 'js-cookie';
import 'element-plus/dist/index.css';
import ElementPlus from 'element-plus';
import locale from 'element-plus/lib/locale/lang/zh-cn'; // 中文语言

import '@/assets/styles/index.scss'; // global css
import App from './App';
import router from './router';
import directive from './directive'; // directive

const app = createApp(App);

app.use(router);

directive(app);

// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
  locale: locale,
  // 支持 large、default、small
  size: Cookies.get('size') || 'default'
});

// 修改 el-dialog 默认点击遮照为不关闭
app._context.components.ElDialog.props.closeOnClickModal.default = false;

app.mount('#app');
